package com.mrxu.monitor.notice.impl;

import cn.hutool.extra.mail.MailUtil;
import com.mrxu.monitor.config.MonitorProperties;
import com.mrxu.monitor.notice.NotifyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class EmailNotifyService implements NotifyService {

    @Autowired
    private MonitorProperties properties;

    @Override
    public void sendMsg(String content) {
        log.info("发送email消息通知:{}",content);
        MailUtil.send(properties.getNotify().getToEmail(), "API 告警", content, false);
    }

}